﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ChuangDu_Spirit_QGB_BLL.ZJYBLL;
using ChuangDu_Spirit_QGB_BLLContainer;
using ChuangDu_Spirit_QGB_IBLL.ZJYIBLL;
using ChuangDu_Spirit_QGB_Model;

namespace ChuangDu_Spirit_QGB.Areas.Sprintzjy.Controllers
{
    public class MyCustomerController : Controller
    {
        // GET: Sprintzjy/MyCustomer
        #region 我的全部客户模块
        /// <summary>
        /// 显示我的全部客户
        /// </summary>
        /// <returns></returns>
        private MyCustomerIBLL userbll = BLLContainer.Resolve<MyCustomerBLL,MyCustomerIBLL>();
        public int CustomerDel(CustomerInfo t)
        {
            int i = userbll.Delete(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CustomerUpt(CustomerInfo t)
        {
            int i = userbll.Update(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        public int CustomerAdd()
        {
            CustomerInfo t = new CustomerInfo();
            int i = userbll.Add(t);
            if (i > 0)
                return 1;
            else
                return 0;
        }
        /// <summary>WW
        /// 我的所有客户显示页面
        /// </summary>
        /// <returns></returns>
        public ActionResult MyCustomerIndex()
        {
            return View();
        }
        public JsonResult Show()
        {           
            var list = userbll.show();
            //匿名类
            var Construction = new { code = 0, count = 1000, msg = "", data = list };
            return Json(Construction, JsonRequestBehavior.AllowGet);
        }
        #endregion

    }
}